de_trinitycorefandomcom_de-20200214-history
Howto mac tc2
Introduction TrinityCore is a rather complex and demanding software, and as such, it may seem quite daunting to install and maintain. This HOWTO is an attempt to help make this process less daunting and additionally, at the end of this process you would have learnt quite a few new things about your Mac. This wiki page is divided in several parts: * Installing the prerequisites (starting from Requirements) * Compiling and installing TrinityCore (starting from Pulling the Source) * Manage the databases (starting from INSTALLING THE DATABASES) * Configure and run the server (starting from SETTING UP THE SERVER) Important: As the TrinityCore project is highly active, portions of the guide may be outdated. In case something fails, please check the forum, which will usually have the answer already. Notes Don't be afraid. The majority of the tedious tasks in the wiki are one time ones and dont need to be repeated ever again. Once you've completed the procedure, you'll only have to update the sources, create the XCode project file, compile and install, update the databases (literally 5 commands) Credits * imbecile on TC Forums for initial guide * elegos for the libraries (compile and install) and compile procedures * all the contributors (see History) Getting Started Requirements First a small intro. Software installation on MacOSX can be done in multiple ways. The most common method is to go to the software's site and download the package (usually in the form of a DMG or a cpkg) and install it. While this is easy and works for packages without dependencies, this method is not essy to work with in situations where multiple packages with dependencies are involved. The most well known example would be the packaging systems available on most of the Unix like systems, ranging from BSD derivatives to open solaris to linux. MacOSX is considered to be part of the BSD family and consequently a package management system like the ones used in other BSD derivaties has been developed for it. This is the MacPorts package management system. Thus, most of the packages listed below can be installed in multiple ways, either through a package from the software's home page or through the MacPorts system. *'Xcode' - You can install it from the Mac OS X installation DVD, or download it from the Apple website. During the installation you have to install the optional package "UNIX Development Support". Note that this is essential for installing macports *'MySQL Community Server' - it can be downloaded from the MySQL's website. To control MySQL from System Preferences, also install the MySQL.prefPane inside the disk image. *'CMake' - Cross-platform, open-source build system. You can both install directly downloading a .dmg file or compiling via MacPorts (suggested, using a GUI like Porticus if you like) *'Mercurial' - Source Code Management Tool. You can get an installer from the site or install it via macports. *'GNU Readline' - Mac OS X comes with a custom readline library which is not good for trinity. You can both compile from sources or via MacPorts (see CMake) *'ACE' - ADAPTIVE Communication Environment. You need to download the source files and compile it (see "Compiling the ACE library" for more details) ---- Using MacPorts MacPorts is a helpful tool which enables you to compile and install a lot of UNIX tools just in one command. It downloads the source files, the relative patches to make them compile under OSX (if any), it applies the patches, compiles the sources and install the resulting binary, library or whatever in a custom, safe directory (/opt/local). This means that if you want to restore your OSX installation, you only have to delete the /opt/local folder (brutal) or uninstall packages via port or Porticus (suggested). You can also download packages that are not BSD derived (like the GNU version of readline as opposed to the BSD editline bundled), and due to the custom path it will be completely harmless. Updating and Upgrading It's allways a good idea to keep libraries up-to-date. To do so, you have to run two easy commands: sudo port selfupdate (to update the ports list an eventually download a new version of the tool) and sudo port upgrade outdated to compile the new versions of the files compiled under port. Installing new libraries You need some packages to build TrinityCore under OSX, you can use MacPorts to install three of them: cmake, mercurial and readline. To install these three packages you only need to run sudo port install cmake mercurial readline Porticus Porticus is a graphical front-end of Port. You can do all the things explained in the upper parts just clicking like a Windows user :- ) ---- Compiling custom libraries in Mac OS X The short story is that OSX has its own libraries and you should never mess around with them or (the worst thing you may do) override the OSX libraries with other versions (it may make the system unstable or even it could compromise its startup!). In order to avoid this kind of catastrophe, it's a good habit then to install custom libraries or binaries in a safe path. We're going to use /opt/local just like MacPorts does for this purpose. ---- Compile GNU Readline (no MacPorts) *Extract the source files somewhere in your computer (for example in (home dir)/Resources) and open the Terminal application. * In the Terminal, use these commands cd WHERE/YOU/EXTRACTED/THE/FILES/readline-6.1 mkdir build cd build ../configure --prefix=/opt/local make -j2 sudo make install Your library will be /opt/local/lib/libreadline.dylib and the header files will be present in /opt/local/include ---- Compile ACE ACE is a little bit harder to compile, but you're fortunate, as I found the easy way just for you :- ) After trying several configurations, I found out that you need to compile it statically and not dynamically due to the Apple's different ld options. That's not a problem, as it works like a charm. Notes: if you're compiling for Leopard, substitute 10.6 with 10.5, and snowleopard with leopard. *Download the ACE library from the download page (under the section Latest Release, the package with ACE only), in my case ACE-5.8.0.zip *Extract the files somewhere *In Terminal (this will create a bash profile to compile the library): cd WHERE/YOU/EXTRACTED/ACE/ACE_wrappers export ACE_ROOT=$(pwd) echo "export ACE_ROOT=$ACE_ROOT" >> bash_profile echo "export LD_LIBRARY_PATH=$ACE_ROOT/ace:$ACE_ROOT/lib" >> bash_profile echo "export DYLD_LIBRARY_PATH=$ACE_ROOT/ace:$ACE_ROOT/lib" >> bash_profile echo "export MACOSX_DEPLOYMENT_TARGET=10.6" >> bash_profile *Create the file ACE_wrappers/ace/config.h with this text: #include "ace/config-macosx-snowleopard.h" *Create the file ACE_wrappers/include/makeinclude/platform_macros.GNU with this text: debug = 1 shared_libs = 0 static_libs = 1 include ${ACE_ROOT}/include/makeinclude/platform_macosx_snowleopard.GNU INSTALL_PREFIX = /opt/local *In Terminal (this will actually compile and install the library): source bash_profile cd ace make -j2 sudo su cd .. source bash_profile cd ace make install exit Note: if you get the "/bin/sh^M: bad interpreter" error, it's due to the Windows new line style. You have to open that file and save with UNIX format (hint: use a text processor like TextWrangler and save as -> New line stile: UNIX). Pulling the Source Use Terminal: hg clone https://trinitycore.googlecode.com/hg/ trinitycore Mercurial must be installed. ---- Make TrinityCore Mac OS X compilable TrinityCore should be Mac OS X compilable, but actually it's not. There's an open ticket with the patch elegos made to make it fully compatible (download it here: tc_osx_diff_g3d_included.diff. You can find all the differences in comment 6. If the ticket is signed as "Fixed" just ignore this section. *Once you've downloaded the diff file, put it somewhere (I suggest to put it in the parent folder of the trinitycore one). To patch the source files, in Terminal (# are comments): cd ~/Resources/trinitycore # my TrinityCore source directoroy patch -p1 < ../tc_osx_diff_g3d_included.diff # my diff file Compile TrinityCore * To create an XCode solution, in Terminal: cd ~/my/trinitycore/source/dir mkdir build cd build cmake ../ -GXcode \ -DMYSQL_ADD_INCLUDE_PATH=/usr/local/mysql \ -DREADLINE_INCLUDE_DIR=/opt/local/include \ -DREADLINE_LIBRARY=/opt/local/lib/libreadline.dylib \ -DACE_INCLUDE_DIR=/opt/local/include \ -DACE_LIBRARY=/opt/local/lib/mnjkllnkjo.a \ -DPREFIX=/opt/trinitycore \ -DWARNINGS=0 **-GXcode: generate an XCode solution ** -DMYSQL_ADD_INCLUDE_PATH: where to search for MySQL header files **-DREADLINE_INCLUDE_DIR: where to search for the GNU readline headers **-DREADLINE_LIBRARY: the dylib the GNU readline headers point to **-DACE_INCLUDE_DIR: where to search for the ACE headers **-DACE_LIBRARY: the static ACE library **-DPREFIX: where to install the compiled things ($PREFIX/bin $PREFIX/etc $PREFIX/log etc.) **-DWARNINGS: disable the output of warnings (BOOL) *Now open the TrinityCore.xcodeproj file found under the build subfolder of the trinitycore sources directory, select the target "ALL_BUILD", Build->Build (CMD+B) *In Terminal, from the build subdir (sudo is used if you're gonna install tirnitycore in a folder in which you have no permissions, like /opt as default (you can edit its group to access it with XRW permissions)): sudo xcodebuild -target install NOTE: the files within $PREFIX/etc have a suffix ".dist", you have to remove it, or copy the dist files to the same without the suffix in order to make the server run. sudo cp /opt/trinitycore/etc/authserver.conf.dist /opt/trinitycore/etc/authserver.conf sudo cp /opt/trinitycore/etc/worldserver.conf.dist /opt/trinitycore/etc/worldserver.conf Keeping the code up to date TrinityCore Developers are always at work fixing and adding new features to the core. You can always check them here. To update the core files, go into the trinitycore sources directory and revert all your patches (to avoid conflicts) via hg revert (this will revert the OSX compatibility patch too!), retrieve the updates via hg pull and in the end you can update your local copy via hg update: cd YOUR/TRINITY/SOURCES/DIR hg revert -a --no-backup hg pull hg update Then continue this guide from Make TrinityCore Mac OS X compilable INSTALLING THE DATABASES Pulling the Source Simply type /opt/src: hg clone https://trinitydb.googlecode.com/hg/ trinitydb A folder trinitydb will be created and all files will be stored in there. Installing MySQL Server When configuring MySQL make sure you remember the password you set for the default root account and that you enabled both MyISAM and InnoDB engines. You can leave all the other settings as default. You might want to enable remote access to your MySQL server if your are also testing a website for your Trinity server or if you have friends testing with you which need access from remote. Remember that this will decrease the security level of your MySQL server! Installing The Trinity Databases Trinity needs three databases to run: auth - holds accounts data. characters - holds characters data. world - holds game-experience content such as spawns, stats, quests, etc. The first two are to be taken from the Core directory, the world DB is to be taken from the TDB directory. NOTE: This Guide is only for a fresh and new installation of TDB ! ''Note: The auth database was previously named realmd. If you are having trouble and searching the forum for solutions, any reference to the realmd database now refers to the auth database''. 1) Create the three databases by importing /home/trinity/trinitycore/sql/create_mysql.sql. You now have three databases called auth, characters and world. 2) Import auth database structure by importing /home/trinity/trinitycore/sql/auth_database.sql in the auth DB. 3) Import characters database structure by importing /home/trinity/trinitycore/sql/characters_database.sql in the characters DB. 4) Unzip /home/trinitydb/fulldb/TDB_335.10.32_8874.zip and import world DB structure and contents by importing TDB_335.10.32_8874.sql in the world DB. 5) Import all *.sql update files from /home/trinity/trinitycore/sql/updates/ which start with a number above '8874' so that your DB structure is up to date with the revision you just pulled and compiled. Note: Now your world DB structure is for TrinityCore revision 8874. You need to import the update files to have the proper world DB structure for the revision you just pulled and compiled.. You will notice they are all named XXXX_world_tablename.sql or XXXX_character_tablename.sql or XXXX_auth_tablename.sql, and you need to import the *_world_*.sql files only! XXXX_world_tablename.sql -> World DB XXXX_character_tablename.sql -> Characters DB XXXX_auth_tablename.sql -> Realm DB Keeping the DB up to date TDB Developers are always at work fixing and adding new data to the DB. Unlike Core development, DB updatepacks come more on a 1-2 times a month basis with many fixes from the forum and a lot of new data from the Developers and Contributors. Same procedure as for the core, cd into the trintydb folder and type hg pull and then hg update. SETTING UP THE SERVER Now that you have the Source compiled and the Databases installed, you need to set up the server. Extracting dbc, maps and vmaps files In order to run Trinity needs dbc and maps files. In addition, if you want to enable vmaps (mobs not seeing through walls, etc) you will need to extract them as well. Warning: use Trinity's extractors. If you use extractors from other projects it is almost certain that your Trinity Core will not recognize the extracted data! dbc and maps files *Compile map and DBC extractor. In the trinitycore source directory, run cd contrib/extractor && mkdir build && cd build && cmake ../ && make *Extract the maps and DBCs. In the build directory for the extractor ln -s "/Applications/World of Warcraft/Data" ./ad *Move the two newly created folders (maps, dbc) to the trinity installation directory mkdir /opt/trinitycore/data mv maps dbc /opt/trinitycore/data *Alternatively, you can run the extractor on Windows and copy the dbc's to your Mac. vmaps (optional) You can also extract vmaps which will take quite a while depending on your machine (1-2 hours). Note: This part must be done on a Windows machine. At the moment, there is no Mac guide for that. EDIT: It is possible to do the extraction on MacOSX, but will require a bit more work before it can be documented here. Copy all files from /home/trinity/trinitycore/contrib/vmap_extract_assembler_bin/ to where all your binaries, dbc dir and maps dir are. Run makevmaps_SIMPLE.bat. It will take a long time. It will first create a directory called 'buildings'. Then it will start extracting files to the directory 'vmaps'. You will not see any progress in the application's window or anything else. You will just notice files being created in the 'vmaps' folder as it is proceeding. Do not stop the process. It will ask to "press any key" to terminate the program when it is finished. Configuring the Server First of all you need to create 2 files trinitycore.conf and trinityrealm.conf in your /opt/trinitycore/etc/ folder. There should be 2 files named trinitycore.conf.dist and trinityrealm.conf.dist. Open the trinitycore.conf.dist file and copy its complete contents into the trinitycore.conf file. Same for the trinityrealm file. trinitycore.conf Edit MySQL account username and password (instead of trinity;trinity). LoginDatabaseInfo = "YOUR_IP;YOUR_PORT;MYSQL_USERNAME;MYSQL_PASSWORD;REALM_DB_NAME" WorldDatabaseInfo = "YOUR_IP;YOUR_PORT;MYSQL_USERNAME;MYSQL_PASSWORD;WORLD_DB_NAME" CharacterDatabaseInfo = "YOUR_IP;YOUR_PORT;MYSQL_USERNAME;MYSQL_PASSWORD;CHARACTERS_DB_NAME" Standard Values: LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" WorldDatabaseInfo = "127.0.0.1;3306;trinity;trinity;world" CharacterDatabaseInfo = "127.0.0.1;3306;trinity;trinity;characters" If you extracted vmaps then edit the following: vmap.enableLOS = 1 -- set this to 1 vmap.enableHeight = 1 -- set this to 1 vmap.ignoreMapIds = "369" vmap.ignoreSpellIds = "7720" vmap.petLOS = 1 -- set this to 1 trinityrealm.conf Edit MySQL account username and password (instead of trinity;trinity). LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" Realmlist table You need to make sure that trinityrealm binary directs incoming connections to your realm. In the auth DB there is a table called realmlist. You need to edit the field address according to your needs: 127.0.0.1 -- Leave default localhost if you are connecting alone from the same machine Trinity runs on. LAN ip -- Use the machine's LAN ip if you want other computers from the same network as Trinity's to connect to your server. Public ip -- Use your public ip if you have friends and testers which need to connect your server from the internet. Warning: The TrinityCore Development Team and Owners and the TrinityDB Team and Owners DO NOT in any case sponsor nor support illegal public servers. If you use these projects to run an illegal public server and not for testing and learning it is your own personal choice. SUPPORT & CONCLUSION This guide is for beginners and states what to do and what to edit, assuming you left everything else with default values. Visit the following threads and post questions if you still need special support: *TortoiseHG *Compiling the Source *Installing the Database Category:Guides_for_Trinity